package dbModel

import (
	nailGen "back/entity/gen"
	"gorm.io/datatypes"
	"time"
)

type BaseModel struct {
	ID        uint `gorm:"primaryKey;AUTO_INCREMENT" json:"id"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Member struct {
	BaseModel      `gorm:"embedded"`
	nailGen.Member `gorm:"embedded"`
}

func (r *Member) TableName() string {
	return TableMember
}

type MemberCard struct {
	BaseModel
	nailGen.MemberCard
	//create 创建日期
	//update 消费/充值日期
}

func (r *MemberCard) TableName() string {
	return TableMemberCard
}

type MemberCardLog struct {
	BaseModel
	nailGen.MemberCardLog
}

func (r *MemberCardLog) TableName() string {
	return TableMemberCardLog
}

type Project struct {
	BaseModel
	nailGen.Project
}

func (r *Project) TableName() string {
	return TableProject
}

type Service struct {
	BaseModel
	nailGen.Service
	Services datatypes.JSONType[Product] `json:"services"    gorm:"serializer:json;column:services"`
}

func (r *Service) TableName() string {
	return TableService
}

type Product struct {
	ID uint `gorm:"primaryKey;AUTO_INCREMENT" json:"id"`
	nailGen.Product
}

func (r *Product) TableName() string {
	return TableProduct
}

type StorageRecord struct {
	BaseModel //create
	nailGen.StorageRecord
	In bool `gorm:"column:quantity;type:integer;comment:'进货?'" json:"in"`
}

func (r *StorageRecord) TableName() string {
	return TableStorageRecord
}
